package com.forezp.thinking.chapter18;

import java.io.*;

/**
 * Created by forezp on 2017/12/8.
 */
public class BasicFileOutput {


    public static void main(String[] args) throws IOException {

        PrintWriter printWriter = new PrintWriter(
                new BufferedWriter(
                        new FileWriter(Constants.OUT_FILE_NAME)));

        BufferedReader bufferedReader = new BufferedReader(new FileReader(Constants.IN_FILE_NAME));
        String s;
        int line = 0;
        while ((s = bufferedReader.readLine()) != null) {
            printWriter.write((++line) + ":" + s);
            System.out.print((line) + s + ":" + "\n");
        }
        printWriter.close();
        bufferedReader.close();

    }
}
